package com.basic.backend.model.enums;

import lombok.Getter;

/**
 * 文章状态枚举 
 */
@Getter
public enum ArticleStatusEnum {
    DRAFT(0, "草稿"),
    UNDER_REVIEW(1, "审核中"),
    PUBLISHED(2, "已发布"),
    BANNED(3, "已封禁"),
    PRIVATE(4, "仅自己可见");

    private final Integer code;
    private final String description;

    ArticleStatusEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    public static ArticleStatusEnum getByCode(Integer code) {
        for (ArticleStatusEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}